<div class="alert alert-success" role="alert">
  您正在<strong>新增网站配置</strong>！
  <button class="btn btn-default btn-bor-success back-to-list" type="button" (click)="$event.view.history.back()">返回列表
  </button>
</div>

<form #addArticleForm="ngForm">

  <div class="form-group clearfix">
    <label class="col-md-2"><span class="require-red">*</span>公司名称</label>
    <div class="col-md-6">
      <input type="text" class="form-control" required  name="company_name" #company_name="ngModel" [(ngModel)]="addHomeConfig.company_name">
      <p [hidden]="company_name.pristine || company_name.valid" class="alert alert-danger">公司名称不能为空!</p>
    </div>
  </div>
  <div class="form-group clearfix">
    <label class="col-md-2"><span class="require-red">*</span>站点名称</label>
    <div class="col-md-6">
      <input type="text" class="form-control" required  name="site_name" #site_name="ngModel" [(ngModel)]="addHomeConfig.site_name">
      <p [hidden]="site_name.pristine || site_name.valid" class="alert alert-danger">站点名称不能为空!</p>
    </div>
  </div>
  <div class="form-group clearfix">
    <label class="col-md-2"><span class="require-red">*</span>站点Logo</label>
    <div class="col-md-6">
      <div class="ui-file">
        <i class="iconfont icon-add"></i>
        上传图片
        <input class="ui-file-input" type="file" name="license" (change)="uploadImg($event,'logo')">
      </div>
      <div class="edvert-photo-warp">
        <img class="imgSize" src="{{img_url}}">
      </div>
      <div class="alert alert-danger" *ngIf="!hasUploadImg">
        <p>必须上传站点Logo</p>
      </div>
    </div>
  </div>
  <div class="form-group clearfix">
    <label class="col-md-2"><span class="require-red">*</span>电话号码</label>
    <div class="col-md-6">
      <input type="text" class="form-control" required  name="tel" #tel="ngModel" [(ngModel)]="addHomeConfig.tel">
      <p [hidden]="tel.pristine || tel.valid" class="alert alert-danger">电话号码不能为空!</p>
    </div>
  </div>
  <div class="form-group clearfix">
    <label class="col-md-2"><span class="require-red">*</span>营业时间</label>
    <div class="col-md-6">
      <input type="text" class="form-control" required  name="open_time" #open_time="ngModel" [(ngModel)]="addHomeConfig.open_time">
      <p [hidden]="open_time.pristine || open_time.valid" class="alert alert-danger">营业时间不能为空!</p>
    </div>
  </div>
  <div class="form-group clearfix">
    <label class="col-md-2"><span class="require-red">*</span>电子邮箱</label>
    <div class="col-md-6">
      <input type="text" class="form-control" id="user_email" [(ngModel)]="addHomeConfig.email" name="email" required appValidateEmail>
      <div [hidden]="addArticleForm.controls.email?.valid || addArticleForm.controls.email?.pristine" class="alert alert-danger">
        <p *ngIf="addArticleForm.controls.email?.errors?.required">电子邮箱不能为空！</p>
        <p *ngIf="addArticleForm.controls.email?.errors?.validateEmail">邮箱格式不正确</p>
      </div>
    </div>
  </div>
  <div class="form-group clearfix">
    <label class="col-md-2"><span class="require-red">*</span>地址</label>
    <div class="col-md-6">
      <input type="text" class="form-control" required  name="adress" #adress="ngModel" [(ngModel)]="addHomeConfig.adress">
      <p [hidden]="adress.pristine || adress.valid" class="alert alert-danger">地址不能为空!</p>
    </div>
  </div>
  <div class="form-group clearfix">
    <label class="col-md-2">版权信息</label>
    <div class="col-md-6">
      <input type="text" class="form-control" name="copyright" #copyright="ngModel" [(ngModel)]="addHomeConfig.copyright">
    </div>
  </div>
  <div class="form-group clearfix">
    <label class="col-md-2">官网微信二维码</label>
    <div class="col-md-6">
      <div class="ui-file">
        <i class="iconfont icon-add"></i>
        上传图片
        <input class="ui-file-input" type="file" name="license" (change)="uploadImg($event,'ewm')">
      </div>
      <div class="edvert-photo-warp">
        <img class="imgSize" src="{{ewm_url}}">
      </div>
    </div>
  </div>
  <div class="form-group clearfix">
    <label class="col-md-2">官方微信二维码说明</label>
    <div class="col-md-6">
      <input type="text" class="form-control" name="weichat_ewm_desc" #weichat_ewm_desc="ngModel" [(ngModel)]="addHomeConfig.weichat_ewm_desc">
    </div>
  </div>
  <div class="form-group clearfix">
    <label class="col-md-2">工信部备案号</label>
    <div class="col-md-6">
      <input type="text" class="form-control" name="moiai_recordation" #moiai_recordation="ngModel" [(ngModel)]="addHomeConfig.moiai_recordation">
    </div>
  </div>
  <div class="form-group clearfix">
    <label class="col-md-2">使用状态</label>
    <div class="col-md-2">
      <select class="form-control" [(ngModel)]="addHomeConfig.is_use" name="is_use">
        <option value="0">在用</option>
        <option value="1">停用</option>
      </select>
    </div>
  </div>
</form>
<div class="text-center">
  <button type="submit" class="btn btn-success" [disabled]="!addArticleForm.form.valid" (click)="submitForm()">提　交</button>
  <button class="btn btn-default">取 消</button>
</div>

<app-notification [type]="type" [message]="message" [isShow]="isShow" (promptIsShow)="isShow = $event"></app-notification>

